package cn.kgc.user.service;

import cn.kgc.common.entity.Author;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * Created by teacher ZHANG on 2023/2/7
 */
@Service
public class AuthorServiceImpl implements AuthorService {
    @Autowired
    private RestTemplate restTemplate;
    @Value("${rest.author.url}")
    private String authorUrl;

    @Override
    public Author findAuthor(String username) {
        return restTemplate.getForObject(authorUrl + "?username=" + username, Author.class);
    }
}
